package org.crown.project.api.module.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.crown.project.api.module.demo.domain.Demo;
import org.crown.project.api.module.demo.mapper.DemoMapper;
import org.crown.project.api.module.demo.service.DemoService;
import org.crown.framework.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 票子 服务实现类
 * </p>
 *
 * @author WuFengSheng
 * @since 2020-03-07
 */
@Service
public class DemoServiceImpl extends BaseServiceImpl<DemoMapper, Demo> implements DemoService{

    /**
      * 分页查询
      *
      * @param pageNum
      * @param pageSize
      * @param demo
      * @return
      */
    @Override
    public PageInfo<Demo> page(int pageNum, int pageSize, Demo demo){
        PageHelper.startPage(pageNum, pageSize);
        QueryWrapper<Demo> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(demo);
        return new PageInfo<Demo>(baseMapper.selectList(queryWrapper));
    }

}
